package com.scf.fruit.business.useraddress.controller;

import com.scf.fruit.business.useraddress.bo.UserAddressBo;
import com.scf.fruit.business.useraddress.po.UserAddressReq;
import com.scf.fruit.configuration.web.LoginValid;
import com.scf.fruit.util.ResponseVo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * @author : 孙超飞
 * @title :
 * @description :
 * @copyright :
 * @date : 2018-05-18 16:11
 */
@Controller
@RequestMapping(value = "/userAddress",produces = "application/json")
public class UserAddressController {
    @Resource
    private UserAddressBo userAddressBo;

    @ResponseBody
    @RequestMapping(value = "/saveUserAddress",method = RequestMethod.POST)
    @LoginValid
    public ResponseVo saveUserAddress(HttpServletRequest request,@RequestBody UserAddressReq req){
        String userId = request.getHeader("USERID");
        return userAddressBo.saveUserAddress(Long.valueOf(userId), req);
    }
}
